﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Web.View.syskeysMenu.Default" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>syskeys</title>
    <script src="/View/js/Alert.js" type="text/javascript"></script> 
    <script type="text/javascript">
        function SetWinData(index) {
            document.getElementById("Hid").value = syskeys_MainStore.getAt(index).get('id');
            
			Txttype.setValue(syskeys_MainStore.getAt(index).get('type'));
			TxtNumdepid.setValue(syskeys_MainStore.getAt(index).get('depid'));
			TxtNumkeycnt.setValue(syskeys_MainStore.getAt(index).get('keycnt'));
			TxtNumsize.setValue(syskeys_MainStore.getAt(index).get('size'));
			Txtkey1.setValue(syskeys_MainStore.getAt(index).get('key1'));
			Txtkey2.setValue(syskeys_MainStore.getAt(index).get('key2'));
			Txtkey3.setValue(syskeys_MainStore.getAt(index).get('key3'));
			Txtkey4.setValue(syskeys_MainStore.getAt(index).get('key4'));
			Txtkey5.setValue(syskeys_MainStore.getAt(index).get('key5'));
			Txtkey6.setValue(syskeys_MainStore.getAt(index).get('key6'));
			Txtkey7.setValue(syskeys_MainStore.getAt(index).get('key7'));
			Txtkey8.setValue(syskeys_MainStore.getAt(index).get('key8'));
			Txtdepkey1.setValue(syskeys_MainStore.getAt(index).get('depkey1'));
			Txtdepkey2.setValue(syskeys_MainStore.getAt(index).get('depkey2'));
			Txtdepkey3.setValue(syskeys_MainStore.getAt(index).get('depkey3'));
			Txtdepkey4.setValue(syskeys_MainStore.getAt(index).get('depkey4'));
			Txtdepkey5.setValue(syskeys_MainStore.getAt(index).get('depkey5'));
			Txtdepkey6.setValue(syskeys_MainStore.getAt(index).get('depkey6'));
			Txtdepkey7.setValue(syskeys_MainStore.getAt(index).get('depkey7'));
			Txtdepkey8.setValue(syskeys_MainStore.getAt(index).get('depkey8'));

            syskeys_Win.show();
        }
    </script>
</head>
<body>
    <form id="MainForm" runat="server">
    <ext:ResourceManager ID="MainResourceMgr" runat="server" />
    <!--用来导出到Excel的数据源-->
    <ext:Hidden ID="ExcelGridData" runat="server" />
    <!--syskeys表页面主数据元，自动生成-->
    <ext:Store runat="server" ID="syskeys_MainStore" OnRefreshData="syskeys_DataBind" AutoLoad="true">
        <Proxy>
            <ext:PageProxy />
        </Proxy>
        <Reader>
            <ext:JsonReader IDProperty="id">
                <Fields>
                    
					<ext:RecordField Name="id" />
					<ext:RecordField Name="type" />
					<ext:RecordField Name="depid" />
					<ext:RecordField Name="keycnt" />
					<ext:RecordField Name="size" />
					<ext:RecordField Name="key1" />
					<ext:RecordField Name="key2" />
					<ext:RecordField Name="key3" />
					<ext:RecordField Name="key4" />
					<ext:RecordField Name="key5" />
					<ext:RecordField Name="key6" />
					<ext:RecordField Name="key7" />
					<ext:RecordField Name="key8" />
					<ext:RecordField Name="depkey1" />
					<ext:RecordField Name="depkey2" />
					<ext:RecordField Name="depkey3" />
					<ext:RecordField Name="depkey4" />
					<ext:RecordField Name="depkey5" />
					<ext:RecordField Name="depkey6" />
					<ext:RecordField Name="depkey7" />
					<ext:RecordField Name="depkey8" />

                </Fields>
            </ext:JsonReader>
        </Reader> 
        <BaseParams>
            <ext:Parameter Name="start" Value="0" Mode="Raw">
            </ext:Parameter>
            <ext:Parameter Name="limit" Value="15" Mode="Raw">
            </ext:Parameter>
        </BaseParams>
    </ext:Store>
    <!--syskeys页面主表格-->
    <ext:Viewport ID="MainViewPort" runat="server">
        <Items>
            <ext:FitLayout>
                <Items>
                    <ext:GridPanel ID="syskeys_Grid" Layout="fit" TrackMouseOver="true" runat="server" StoreID="syskeys_MainStore"
                        StripeRows="true" Header="false" Border="false" Collapsible="true">
                        <TopBar>
                            <ext:Toolbar ID="MainToolBar" runat="server">
                                <Items>
                                    <ext:Button ID="BtnAdd" runat="server" Text="添加" Icon="Add">
                                        <Listeners>
                                            <Click Handler="#{syskeys_MainForm}.getForm().reset();#{Hid}.setValue('');#{syskeys_Win}.show();" />
                                        </Listeners>
                                    </ext:Button>
                                    <ext:Button ID="BtnDel" runat="server" Text="删除" Icon="Delete">
                                        <DirectEvents>
                                            <Click OnEvent="BtnDel_Click">
                                                <Confirmation ConfirmRequest="true" Title="确认" Message="确实要删除吗?" />
                                                <EventMask ShowMask="true" Msg="正在删除数据，请等候 ..." />
                                            </Click>
                                        </DirectEvents>
                                        <Listeners>
                                            <Click Handler="if(#{syskeys_Grid}.getSelectionModel().getCount()<=0) {TellAlert('请选择要删除的记录');return false;}" />
                                        </Listeners>
                                    </ext:Button>
                                    <ext:ToolbarSeparator />
                                    <ext:Button ID="BtnReload" runat="server" Text="重新加载" Icon="Reload">
                                        <Listeners>
                                            <Click Handler="#{syskeys_MainStore}.reload();" />
                                        </Listeners>
                                    </ext:Button>
                                    <ext:ToolbarFill />
                                    <ext:Button ID="BtnToExcel" runat="server" Text="To Excel" AutoPostBack="true" OnClick="BtnSaveToExcel"
                                        Icon="PageExcel">
                                        <Listeners>
                                            <Click Handler="#{ExcelGridData}.setValue(Ext.encode(syskeys_Grid.getRowsValues(false)));" />
                                        </Listeners>
                                        <ToolTips>
                                            <ext:ToolTip Title="将当前页内容存储为Excel文件">
                                            </ext:ToolTip>
                                        </ToolTips>
                                    </ext:Button>
                                </Items>
                            </ext:Toolbar>
                        </TopBar>
                        <ColumnModel ID="syskeys_ColumnMode" runat="server">
                            <Columns>
                                <ext:RowNumbererColumn Width="20" />
                                <ext:Column Header="主键" Sortable="true" Hidden="true" DataIndex="id" />
                                
								<ext:Column Header="type" Sortable="true" DataIndex="type" />
								<ext:Column Header="depid" Sortable="true" DataIndex="depid" />
								<ext:Column Header="keycnt" Sortable="true" DataIndex="keycnt" />
								<ext:Column Header="size" Sortable="true" DataIndex="size" />
								<ext:Column Header="key1" Sortable="true" DataIndex="key1" />
								<ext:Column Header="key2" Sortable="true" DataIndex="key2" />
								<ext:Column Header="key3" Sortable="true" DataIndex="key3" />
								<ext:Column Header="key4" Sortable="true" DataIndex="key4" />
								<ext:Column Header="key5" Sortable="true" DataIndex="key5" />
								<ext:Column Header="key6" Sortable="true" DataIndex="key6" />
								<ext:Column Header="key7" Sortable="true" DataIndex="key7" />
								<ext:Column Header="key8" Sortable="true" DataIndex="key8" />
								<ext:Column Header="depkey1" Sortable="true" DataIndex="depkey1" />
								<ext:Column Header="depkey2" Sortable="true" DataIndex="depkey2" />
								<ext:Column Header="depkey3" Sortable="true" DataIndex="depkey3" />
								<ext:Column Header="depkey4" Sortable="true" DataIndex="depkey4" />
								<ext:Column Header="depkey5" Sortable="true" DataIndex="depkey5" />
								<ext:Column Header="depkey6" Sortable="true" DataIndex="depkey6" />
								<ext:Column Header="depkey7" Sortable="true" DataIndex="depkey7" />
								<ext:Column Header="depkey8" Sortable="true" DataIndex="depkey8" />

                            </Columns>
                        </ColumnModel>
                        <Listeners>
                            <RowDblClick Handler="SetWinData(rowIndex);" />
                        </Listeners>
                        <Plugins>
                            <ext:GridFilters runat="server" FiltersText="查找" ID="syskeys_Filter">
                                <Filters>
                                    
								<ext:StringFilter DataIndex="type" />
								<ext:StringFilter DataIndex="key1" />
								<ext:StringFilter DataIndex="key2" />
								<ext:StringFilter DataIndex="key3" />
								<ext:StringFilter DataIndex="key4" />
								<ext:StringFilter DataIndex="key5" />
								<ext:StringFilter DataIndex="key6" />
								<ext:StringFilter DataIndex="key7" />
								<ext:StringFilter DataIndex="key8" />
								<ext:StringFilter DataIndex="depkey1" />
								<ext:StringFilter DataIndex="depkey2" />
								<ext:StringFilter DataIndex="depkey3" />
								<ext:StringFilter DataIndex="depkey4" />
								<ext:StringFilter DataIndex="depkey5" />
								<ext:StringFilter DataIndex="depkey6" />
								<ext:StringFilter DataIndex="depkey7" />
								<ext:StringFilter DataIndex="depkey8" />

                                </Filters>
                            </ext:GridFilters>
                        </Plugins>
                        <LoadMask ShowMask="true" Msg="正在加载..." />
                        <SelectionModel>
                            <ext:CheckboxSelectionModel ID="CheckBoxGrid" runat="server" />
                        </SelectionModel>
                        <BottomBar>
                            <ext:PagingToolbar ID="PagingToolBar" StoreID="syskeys_MainStore" PageSize="15" runat="server" />
                        </BottomBar>
                    </ext:GridPanel>
                </Items>
            </ext:FitLayout>
        </Items>
    </ext:Viewport>
    
    <!--syskeys表修改，添加主窗体-->
    <ext:Window ID="syskeys_Win" Collapsible="true" Hidden="true" Modal="true"
        Maximizable="true" runat="server" Title="添加/修改记录" Icon="WorldEdit" Width="630" AutoHeight="true"
        Resizable="true">
        <Items>
            <ext:Hidden ID="Hid" runat="server">
            </ext:Hidden>
            <ext:FormPanel ID="syskeys_MainForm" LabelWidth="65" Frame="true" runat="server"
                Border="false" Height="330" Padding="5" Icon="UserAdd" Layout="Column">
                <Items>
                    <ext:Panel runat="server" Border="false" Header="false" ColumnWidth=".5" Layout="Form">
                        <Items>
                            
							<ext:TextField ID="Txttype" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="type" />
							<ext:NumberField ID="TxtNumkeycnt" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="keycnt" />
							<ext:TextField ID="Txtkey1" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="key1" />
							<ext:TextField ID="Txtkey3" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="key3" />
							<ext:TextField ID="Txtkey5" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="key5" />
							<ext:TextField ID="Txtkey7" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="key7" />
							<ext:TextField ID="Txtdepkey1" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="depkey1" />
							<ext:TextField ID="Txtdepkey3" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="depkey3" />
							<ext:TextField ID="Txtdepkey5" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="depkey5" />
							<ext:TextField ID="Txtdepkey7" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="depkey7" />

                        </Items>
                    </ext:Panel>
                    <ext:Panel runat="server" Border="false" Header="false" ColumnWidth=".5" Layout="Form">
                        <Items> 
                            
							<ext:NumberField ID="TxtNumdepid" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="depid" />
							<ext:NumberField ID="TxtNumsize" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="size" />
							<ext:TextField ID="Txtkey2" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="key2" />
							<ext:TextField ID="Txtkey4" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="key4" />
							<ext:TextField ID="Txtkey6" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="key6" />
							<ext:TextField ID="Txtkey8" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="key8" />
							<ext:TextField ID="Txtdepkey2" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="depkey2" />
							<ext:TextField ID="Txtdepkey4" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="depkey4" />
							<ext:TextField ID="Txtdepkey6" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="depkey6" />
							<ext:TextField ID="Txtdepkey8" AnchorHorizontal="92%" runat="server" AllowBlank="false" EmptyText="该项不可为空" FieldLabel="depkey8" />

                        </Items>
                    </ext:Panel>
                </Items>
            </ext:FormPanel>
        </Items>
        <Buttons> 
            <ext:Button Text="提交" ID="BtnSave" runat="server" Icon="Disk">
                <DirectEvents>
                    <Click OnEvent="BtnSave_Click">
                        <EventMask ShowMask="true" Msg="正在提交，请等候 ..."  />
                    </Click>
                </DirectEvents>
                <Listeners>
                    <Click Handler="if (#{syskeys_MainForm}.getForm().isValid()) {;}else{Ext.Msg.show({icon: Ext.MessageBox.ERROR, msg: '您填写的信息不正确，请您确认！', buttons:Ext.Msg.OK});return false;}" />
                </Listeners>
            </ext:Button>
            <ext:Button Text="取消" ID="BtnConcel" Icon="Delete">
                <Listeners>
                    <Click Handler="#{syskeys_Win}.hide();" />
                </Listeners>
            </ext:Button>
        </Buttons>
    </ext:Window>
    </form>
</body>
</html>
